package QL;

import net.sf.json.JSONObject;

public class ButlerGetWorldConnectionResponse extends BaseQLResponse
{
    /// 世界服务器的公网IP地址
    public String PublicIp;

    /// 世界服务器的内网IP地址
    public String PrivateIp;

    /// 服务端口
    public long ServerPort;

    @Override
    public void DeserializeFromJson(JSONObject jsonObj)
    {
        JSONObject t = jsonObj.getJSONObject("error_response");
        if (t != null && !t.isNullObject())
        {
            ErrCode = t.getString("code");
            ErrMsg = t.getString("msg");
        }
        else
        {
            t = jsonObj.getJSONObject("butler_get_world_connection_response");
            if (t.has("public_ip"))
                PublicIp = t.getString("public_ip");
            if (t.has("private_ip"))
                PrivateIp = t.getString("private_ip");
            if (t.has("server_port"))
                ServerPort = t.getLong("server_port");
        }
    }
}
